package com.tj.collection.enums;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WatsonQiu
 * Date: 2017/7/26
 * Time: 下午7:43
 */
public enum ProductTypeEnums {

    ALL("all", "全部产品", 3),
    QSYQ("qsyqall", "轻松有钱", 0),
    SDZZALL("sdzzall", "金壹贷闪电周转", 1),
    SDZZOLD("sdzzold", "老闪电周转", 1),
    XJDRALL("xjdrall", "现金大人", 2),
    //暂时不迁移以下数据
    SDZZRUBBISH("sdzzrubbish", "不规则老闪电周转", 1),
    XJDRRUBBISH("xjdrrubbish", "不规则现金大人", 2);


    private String code;
    private String desc;
    private Integer type;

    ProductTypeEnums(String code, String desc, Integer type) {
        this.code = code;
        this.desc = desc;
        this.type = type;
    }

    public String getCode() {
        return code;
    }

    public ProductTypeEnums setCode(String code) {
        this.code = code;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public ProductTypeEnums setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public Integer getType() {
        return type;
    }

    public ProductTypeEnums setType(Integer type) {
        this.type = type;
        return this;
    }

    public static ProductTypeEnums getEnumByCode(String code) {
        ProductTypeEnums productTypeEnums = null;
        for (ProductTypeEnums enums : ProductTypeEnums.values()) {
            if (enums.getCode().equals(code)) {
                productTypeEnums = enums;
            }
        }

        return productTypeEnums;
    }
}
